-
-
Notifications
You must be signed in to change notification settings - Fork 337
Chore: script to detect which tests to run in CI pipeline #1417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for testcontainers-dotnet ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Does this still work, now that #1437 was merged? |
I may have scanned to quickly across the script, I thought it would rely on the |
Ah, line 64 should be removed now, you are right. Yes, I assumed that if a The general idea of this script is use it in CI, to filter test projects which should be run. For example If PR change 1 file in The cake task |
@digital88 Any particular reason you closed the PR? I think it's a valuable improvement, I just haven't had the time to review and test it yet. |
Hello. I think this PR is a bit outdated and also there exists a better tool for this task (mentioned here #1136 (comment)). But I'm ok to reopen and refresh this PR if we choose this approach. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, we'll use this script with something like #1136 (comment) to generate the JSON (strategy) at runtime, right?
Just a small thing to keep in mind: For the main
and develop
branches, we still need to test everything until we have dedicated projects in Sonar, otherwise the results won't be accurate.
I think the GH status checks are already set up. The "Test Report" will pass once all tests succeed, regardless of how many projects we run.
Yes, the idea is to generate strategy at runtime. For example if only postgres module updated, no need to test other modules. For this block I also made some assumptions, they may not be correct:
Should we change something here as well? For the |
I'll add the runtime mechanism in the next few days, including a hook to filter out projects we don't want to test with your script. After that, I'll review the script closely. |
4900ecd
to
8fa5f1b
Compare
I'm done with the prepation. I think we can just use the changed files and ignore the unrelated projects. I believe we can use the testcontainers-dotnet/.github/scripts/Filter-TestProjects.ps1 Lines 15 to 18 in af1af83
|
Anything I need to change in |
Yeah, we'll need to tweak the script a bit, at least based on what I have in mind.
Something like: Begin {
# TODO: Read all changed files.
$changedFiles = Get-ChangedFiles
}
Process {
if (Accept -InputObject $InputObject -ChangedFiles $changedFiles) {
$InputObject
}
}
function Accept {
Param (
[string]$InputObject,
[string[]]$ChangedFiles
)
return ($ChangedFiles | Where-Object { $_ -Like "*$($InputObject.name)*" }).Count -Gt 0
} WDYT? I don't think there'll be many changes. If you're busy, I can probably take a look next week. |
I think we need something like this action to list all changed files and pass them to script from "outside" via script argument or env variable. Making changed fields as argument also improves script testability. It's hard to test if we are getting changed files inside the script itself. |
I like the approach with the env var |
So we need a new job step there which sets |
Yes, if we use the same mechanism as Go (I haven't looked into it before). I assumed there was something built-in in GH. |
Can we define some rules when and when not configuration should run? From the top of my head (all rules must be checked for a given input configuration):
Not sure how to react on |
I'm not exactly sure what you mean by that.
That's exactly what I had in mind. Sounds like a good way to start, and we can adjust as we go.
I think the fallback should always be to run everything if no rule matches (should be exceptional cases). |
My attempt to help in #1136 (comment)